
import 'package:flutter/material.dart';
import 'package:flutter_app_getx/page/controller/HomeController.dart';
import 'package:flutter_app_getx/page/controller/login_controller.dart';
import 'package:get/get.dart';

class HomeView extends GetView<HomeController> {
  final LoginController _loginController = Get.find();

  @override
  Widget build(BuildContext context) {
    var name = Get.parameters['name'];
    var pwd = Get.parameters['pwd'];

    return Scaffold(
      appBar: AppBar(title: Text("Hello WOrld!")),
      body: Column(
        children: [
          Obx(() => Text("${controller.num}")),
          Text('接收用户参数：$name'),
          Text('接收密码参数：$pwd'),
          Text('通过控制器获取用户名：${_loginController.userName}'),
          Text('通过控制器获取密码：${_loginController.pwd}'),
          FlatButton(
            onPressed: () {
              controller.increment();
            },
            child: Text("add"),
          ),
          FlatButton(
            onPressed: () {
              controller.decrement();
            },
            child: Text("decrement"),
          ),
        ],
      ),
    );
  }
}
